package dao

import (
	"time"
)

type Book struct {
	Id                int       `xorm:"not null pk autoincr INT(11)"`
	Status            int       `xorm:"not null default 0 index TINYINT(4)"`
	Name              string    `xorm:"not null unique VARCHAR(20)"`
	Words             int       `xorm:"not null default 0 INT(11)"`
	Category          int       `xorm:"not null index INT(11)"`
	Tags              string    `xorm:"VARCHAR(255)"`
	Clicks            int64     `xorm:"not null default 0 BIGINT(20)"`
	Desc              string    `xorm:"not null TEXT"`
	Tip               string    `xorm:"VARCHAR(50)"`
	Author            string    `xorm:"VARCHAR(30)"`
	Copyright         string    `xorm:"VARCHAR(255)"`
	Score             int       `xorm:"not null default 0 TINYINT(4)"`
	IsSign            int       `xorm:"not null default 0 TINYINT(4)"`
	OssUrl            string    `xorm:"not null VARCHAR(255)"`
	ReleaseTime       time.Time `xorm:"not null index DATETIME"`
	CreateTime        time.Time `xorm:"not null DATETIME"`
	PublishStatus     int       `xorm:"not null default 0 TINYINT(4)"`
	SerialId          string    `xorm:"not null unique CHAR(32)"`
	ChannelType       int       `xorm:"not null default 0 index TINYINT(4)"`
	ChapterTime       time.Time `xorm:"not null default '00:00:00' TIME"`
	ChapterTotal      int       `xorm:"not null default 0 INT(11)"`
	ChapterDaily      int       `xorm:"not null default 0 SMALLINT(6)"`
	ChapterStart      int       `xorm:"not null default 0 INT(11)"`
	ChapterFinishTime time.Time `xorm:"not null DATETIME"`
}

type BookChapter struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	Status     int       `xorm:"not null default 0 TINYINT(4)"`
	BookId     int       `xorm:"not null unique(u_idx_1) INT(11)"`
	No         int       `xorm:"not null default 0 unique(u_idx_1) INT(11)"`
	Name       string    `xorm:"not null VARCHAR(50)"`
	Price      int       `xorm:"not null default 0 INT(11)"`
	CreateTime time.Time `xorm:"not null DATETIME"`
	UpdateTime time.Time `xorm:"DATETIME"`
	SerialId   string    `xorm:"not null unique CHAR(32)"`
	Words      int       `xorm:"not null default 0 INT(11)"`
}

type ConfigRanking struct {
	ChannelType int `xorm:"not null pk TINYINT(4)"`
	RankId      int `xorm:"not null pk INT(11)"`
	BookId      int `xorm:"not null pk INT(11)"`
	SortId      int `xorm:"not null default 0 INT(11)"`
}

type ConfigTopic struct {
	ChannelType int `xorm:"not null pk TINYINT(4)"`
	TopicType   int `xorm:"not null pk TINYINT(4)"`
	BookId      int `xorm:"not null pk INT(11)"`
	SortId      int `xorm:"not null default 0 INT(11)"`
}

type DailyReport struct {
	ReportDate    time.Time `xorm:"not null pk DATE"`
	AppId         int       `xorm:"not null pk INT(11)"`
	UserNew       int       `xorm:"not null INT(11)"`
	UserLogin     int       `xorm:"not null INT(11)"`
	OrderUser     int       `xorm:"not null INT(11)"`
	OrderTotal    int       `xorm:"not null INT(11)"`
	OrderCount    int       `xorm:"not null INT(11)"`
	OrderUserNew  int       `xorm:"not null INT(11)"`
	OrderTotalNew int       `xorm:"not null INT(11)"`
	OrderCountNew int       `xorm:"not null INT(11)"`
	D1Retention   int       `xorm:"not null INT(11)"`
	D7Retention   int       `xorm:"not null INT(11)"`
	D7UserNew     int       `xorm:"not null INT(11)"`
}

type DailyTask struct {
	UserId    string    `xorm:"not null pk CHAR(8)"`
	Type      int       `xorm:"not null pk TINYINT(4)"`
	AppId     int       `xorm:"not null INT(11)"`
	BeginDate time.Time `xorm:"not null DATETIME"`
	EndDate   time.Time `xorm:"not null DATETIME"`
	Coin      int       `xorm:"not null default 0 INT(11)"`
	Gift      int       `xorm:"not null default 0 INT(11)"`
	Desc      string    `xorm:"not null VARCHAR(100)"`
}

type LogBill struct {
	Id       int       `xorm:"not null pk autoincr INT(11)"`
	UserId   string    `xorm:"not null index CHAR(8)"`
	AppId    int       `xorm:"not null INT(11)"`
	BillType int       `xorm:"not null index TINYINT(4)"`
	ProdCost int       `xorm:"not null default 0 TINYINT(4)"`
	ProdGain int       `xorm:"not null default 0 TINYINT(4)"`
	Cost     int       `xorm:"not null default 0 INT(11)"`
	Gain     int       `xorm:"not null default 0 INT(11)"`
	Title    string    `xorm:"not null VARCHAR(100)"`
	BillDate time.Time `xorm:"not null DATETIME"`
}

type LogFavor struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null unique(u_idx_1) CHAR(8)"`
	BookId     int       `xorm:"not null unique(u_idx_1) INT(11)"`
	CreateDate time.Time `xorm:"not null DATETIME"`
}

type LogLogin struct {
	Id        int       `xorm:"not null pk autoincr INT(11)"`
	UserId    string    `xorm:"not null index CHAR(8)"`
	LoginApp  int       `xorm:"not null index INT(11)"`
	LoginOs   int       `xorm:"not null TINYINT(4)"`
	LoginIp   string    `xorm:"not null VARCHAR(15)"`
	LoginDate time.Time `xorm:"not null DATETIME"`
	LoginMode int       `xorm:"not null TINYINT(4)"`
	UserAgent string    `xorm:"not null VARCHAR(255)"`
}

type LogRead struct {
	Id           int       `xorm:"not null pk autoincr INT(11)"`
	UserId       string    `xorm:"not null index CHAR(8)"`
	AppId        int       `xorm:"not null index INT(11)"`
	BookId       int       `xorm:"not null index INT(11)"`
	ChapterId    int       `xorm:"not null INT(11)"`
	BookChannel  int       `xorm:"not null TINYINT(4)"`
	BookCategory int       `xorm:"not null INT(11)"`
	ReadDate     time.Time `xorm:"not null DATETIME"`
}

type PayApply struct {
	OrderId   string    `xorm:"not null pk CHAR(32)"`
	UserId    string    `xorm:"not null CHAR(8)"`
	AppId     int       `xorm:"not null INT(11)"`
	ItemId    int       `xorm:"not null INT(11)"`
	ApplyDate time.Time `xorm:"not null DATETIME"`
	Amount    int       `xorm:"not null INT(11)"`
	PayType   int       `xorm:"not null default 0 TINYINT(4)"`
	PrepayId  string    `xorm:"VARCHAR(64)"`
}

type PayCancel struct {
	OrderId    string    `xorm:"not null pk CHAR(32)"`
	UserId     string    `xorm:"not null CHAR(8)"`
	AppId      int       `xorm:"not null INT(11)"`
	ItemId     int       `xorm:"not null INT(11)"`
	ApplyDate  time.Time `xorm:"not null DATETIME"`
	CancelDate time.Time `xorm:"not null DATETIME"`
	Amount     int       `xorm:"not null INT(11)"`
	PayType    int       `xorm:"not null default 0 TINYINT(4)"`
}

type PayConfirm struct {
	OrderId       string    `xorm:"not null pk CHAR(32)"`
	UserId        string    `xorm:"not null index CHAR(8)"`
	AppId         int       `xorm:"not null INT(11)"`
	ItemId        int       `xorm:"not null INT(11)"`
	ApplyDate     time.Time `xorm:"not null DATETIME"`
	CommitDate    time.Time `xorm:"not null DATETIME"`
	ConfirmDate   time.Time `xorm:"not null DATETIME"`
	Status        int       `xorm:"not null TINYINT(4)"`
	Amount        int       `xorm:"not null INT(11)"`
	PayType       int       `xorm:"not null default 0 unique(u_idx_1) TINYINT(4)"`
	TransactionId string    `xorm:"not null unique(u_idx_1) VARCHAR(64)"`
}

type PayItem struct {
	Id       int    `xorm:"not null pk autoincr INT(11)"`
	Type     int    `xorm:"not null TINYINT(4)"`
	Code     string `xorm:"not null unique VARCHAR(20)"`
	Name     string `xorm:"not null VARCHAR(20)"`
	Desc     string `xorm:"VARCHAR(40)"`
	Price    int    `xorm:"not null INT(11)"`
	Coin     int    `xorm:"not null default 0 INT(11)"`
	Gift     int    `xorm:"not null default 0 INT(11)"`
	Extra    int    `xorm:"not null default 0 INT(11)"`
	Discount int    `xorm:"not null default 100 TINYINT(4)"`
	ExtraDay int    `xorm:"not null default 0 SMALLINT(6)"`
	LimitDay int    `xorm:"not null default 0 SMALLINT(6)"`
	SortId   int    `xorm:"not null default 0 INT(11)"`
	IsHot    int    `xorm:"not null default 0 TINYINT(4)"`
	IsDouble int    `xorm:"not null default 0 TINYINT(4)"`
	IsDelete int    `xorm:"not null default 0 TINYINT(4)"`
}

type RecChapBuy struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null index CHAR(8)"`
	BookId     int       `xorm:"not null index INT(11)"`
	ChapterId  int       `xorm:"not null index INT(11)"`
	CommitTime time.Time `xorm:"not null DATETIME"`
}

type RecComment struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null index CHAR(8)"`
	BookId     int       `xorm:"not null index INT(11)"`
	Message    string    `xorm:"not null VARCHAR(255)"`
	StarScore  int       `xorm:"not null TINYINT(4)"`
	CreateDate time.Time `xorm:"not null DATETIME"`
}

type RecFeedback struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null index CHAR(8)"`
	Message    string    `xorm:"not null VARCHAR(255)"`
	CreateDate time.Time `xorm:"not null DATETIME"`
}

type RecReading struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null unique CHAR(8)"`
	BookId     string    `xorm:"not null TEXT"`
	ChapterId  string    `xorm:"not null TEXT"`
	UpdateTime time.Time `xorm:"not null DATETIME"`
}

type RecShelf struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	UserId     string    `xorm:"not null unique CHAR(8)"`
	BookId     string    `xorm:"not null TEXT"`
	UpdateTime time.Time `xorm:"not null DATETIME"`
}

type RecSign struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	AppId      int       `xorm:"not null index INT(11)"`
	UserId     string    `xorm:"not null unique(u_idx_1) CHAR(8)"`
	SignPeriod string    `xorm:"not null unique(u_idx_1) CHAR(6)"`
	SignType   int       `xorm:"not null unique(u_idx_1) TINYINT(4)"`
	SignNo     int       `xorm:"not null unique(u_idx_1) INT(11)"`
	SignCoin   int       `xorm:"not null default 0 INT(11)"`
	SignGift   int       `xorm:"not null default 0 INT(11)"`
	SignDate   time.Time `xorm:"not null DATETIME"`
	IsPatch    int       `xorm:"not null TINYINT(4)"`
}

type RecSms struct {
	Id         int       `xorm:"not null pk autoincr INT(11)"`
	AppId      int       `xorm:"not null INT(11)"`
	UserId     string    `xorm:"not null CHAR(8)"`
	Tel        string    `xorm:"not null index CHAR(11)"`
	Code       string    `xorm:"not null CHAR(6)"`
	IsConfirm  int       `xorm:"not null TINYINT(4)"`
	CreateTime time.Time `xorm:"not null DATETIME"`
}

type SysApp struct {
	Id          int    `xorm:"not null pk autoincr INT(11)"`
	Title       string `xorm:"not null VARCHAR(16)"`
	MainId      int    `xorm:"not null INT(11)"`
	AppType     int    `xorm:"not null TINYINT(4)"`
	AppName     string `xorm:"not null VARCHAR(16)"`
	AppShort    string `xorm:"not null unique VARCHAR(8)"`
	BindHost    string `xorm:"not null VARCHAR(50)"`
	SmsId       string `xorm:"not null VARCHAR(6)"`
	DevOriginal string `xorm:"VARCHAR(32)"`
	DevId       string `xorm:"VARCHAR(32)"`
	DevSecret   string `xorm:"VARCHAR(64)"`
	DevToken    string `xorm:"VARCHAR(32)"`
	DevMsgKey   string `xorm:"VARCHAR(64)"`
	PayMchid    string `xorm:"VARCHAR(32)"`
	PaySecret   string `xorm:"VARCHAR(64)"`
	ServiceTime string `xorm:"VARCHAR(30)"`
	ServiceTel  string `xorm:"VARCHAR(20)"`
	ServiceQq   string `xorm:"VARCHAR(20)"`
	ServiceImg  string `xorm:"VARCHAR(255)"`
	PlatShort   string `xorm:"not null VARCHAR(8)"`
	PlatName    string `xorm:"not null VARCHAR(30)"`
	IsLinkage   int    `xorm:"not null default 0 TINYINT(4)"`
	IsDelete    int    `xorm:"not null default 0 TINYINT(4)"`
}

type SysCat struct {
	Id                int    `xorm:"not null pk autoincr INT(11)"`
	CategoryFullname  string `xorm:"not null unique VARCHAR(6)"`
	CategoryShortname string `xorm:"not null unique VARCHAR(2)"`
	CategoryType      int    `xorm:"not null TINYINT(4)"`
	OssPath           string `xorm:"not null CHAR(6)"`
	ChannelType       int    `xorm:"not null default 0 TINYINT(4)"`
	UsedName          string `xorm:"VARCHAR(6)"`
}

type SysRnk struct {
	Id        int    `xorm:"not null pk autoincr INT(11)"`
	RankName  string `xorm:"not null unique VARCHAR(10)"`
	RankImage string `xorm:"not null VARCHAR(255)"`
	IsDelete  int    `xorm:"not null default 0 TINYINT(4)"`
}

type SysSign struct {
	Id   int `xorm:"not null pk autoincr INT(11)"`
	Type int `xorm:"not null TINYINT(4)"`
	No   int `xorm:"not null INT(11)"`
	Coin int `xorm:"not null default 0 INT(11)"`
	Gift int `xorm:"not null default 0 INT(11)"`
}

type SysTag struct {
	Id      int    `xorm:"not null pk autoincr INT(11)"`
	TagName string `xorm:"not null unique VARCHAR(8)"`
}

type SysUid struct {
	Id      int    `xorm:"not null pk autoincr INT(11)"`
	UserId  string `xorm:"not null unique CHAR(8)"`
	BatchId int    `xorm:"not null INT(11)"`
}

type User struct {
	Id           int       `xorm:"not null pk autoincr INT(11)"`
	UserId       string    `xorm:"not null unique CHAR(8)"`
	Status       int       `xorm:"not null default 0 TINYINT(4)"`
	Nickname     string    `xorm:"not null VARCHAR(255)"`
	Avatar       int       `xorm:"not null default 0 TINYINT(4)"`
	Gender       int       `xorm:"not null default 0 TINYINT(4)"`
	Coin         int64     `xorm:"not null default 0 BIGINT(20)"`
	Gift         int64     `xorm:"not null default 0 BIGINT(20)"`
	VipEnd       time.Time `xorm:"not null default '0000-00-00 00:00:00' DATETIME"`
	SerialId     string    `xorm:"not null unique CHAR(32)"`
	RegApp       int       `xorm:"not null INT(11)"`
	RegOs        int       `xorm:"not null default 0 TINYINT(4)"`
	RegIp        string    `xorm:"not null VARCHAR(15)"`
	RegDate      time.Time `xorm:"not null DATETIME"`
	LoginSession string    `xorm:"not null unique CHAR(32)"`
	LoginCnt     int64     `xorm:"not null default 0 BIGINT(20)"`
	PayCnt       int64     `xorm:"not null default 0 BIGINT(20)"`
	CoinCnt      int64     `xorm:"not null default 0 BIGINT(20)"`
	GiftCnt      int64     `xorm:"not null default 0 BIGINT(20)"`
}

type UserTel struct {
	Id       int    `xorm:"not null pk autoincr INT(11)"`
	UserId   string `xorm:"not null unique CHAR(8)"`
	Mobile   string `xorm:"not null unique CHAR(11)"`
	Password string `xorm:"not null CHAR(32)"`
	Salt     string `xorm:"not null CHAR(6)"`
}

type UserUnion struct {
	Id              int       `xorm:"not null pk autoincr INT(11)"`
	AppId           int       `xorm:"not null unique(u_idx_1) INT(11)"`
	OpenId          string    `xorm:"not null unique(u_idx_1) VARCHAR(128)"`
	UnionId         string    `xorm:"not null index VARCHAR(128)"`
	Subscribe       int       `xorm:"not null TINYINT(4)"`
	Nickname        string    `xorm:"not null VARCHAR(40)"`
	Avatar          string    `xorm:"not null VARCHAR(255)"`
	Sex             int       `xorm:"not null default 0 TINYINT(4)"`
	Country         string    `xorm:"not null VARCHAR(20)"`
	Province        string    `xorm:"not null VARCHAR(40)"`
	City            string    `xorm:"not null VARCHAR(40)"`
	SubscribeTime   time.Time `xorm:"not null default '0000-00-00 00:00:00' DATETIME"`
	UnsubscribeTime time.Time `xorm:"not null default '0000-00-00 00:00:00' DATETIME"`
	OnlineDate      time.Time `xorm:"not null DATETIME"`
	LoginDate       time.Time `xorm:"not null default '0000-00-00 00:00:00' DATETIME"`
	CreateDate      time.Time `xorm:"not null DATETIME"`
}

type UserWxmp struct {
	Id       int    `xorm:"not null pk autoincr INT(11)"`
	UserId   string `xorm:"not null unique CHAR(8)"`
	OpenId   string `xorm:"not null unique VARCHAR(128)"`
	UnionId  string `xorm:"not null index VARCHAR(128)"`
	Country  string `xorm:"not null VARCHAR(20)"`
	Province string `xorm:"not null VARCHAR(40)"`
	City     string `xorm:"not null VARCHAR(40)"`
}
